package net;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;

/**
 * @Author Justin Parker
 * @Date 2024/7/18 0018 16:26
 * @Version 1.0
 */
/*
    网络中的客户端对象
 */
public class NetClient {
    public static void main(String[] args) throws IOException {
        //1.构建Socket对象与服务器建立连接
        Socket socket  = new Socket("127.0.0.1",8080);
        System.out.println("尝试客户端连接");
        //2.获取网络输出流对象
        PrintWriter pw = new PrintWriter(socket.getOutputStream(),true);
//        OutputStream os = socket.getOutputStream();
        System.out.println(pw.getClass().getName());

        pw.println("我是你爹！");
//        os.write(234);
//         socket.close();



    }
}
